With the popularity and use of various image optimization applications, image processing functions of terminals such as mobile phones and computers become increasingly richer. Among others, there is a novel function called an image deforming technology, which enables a user to perform an operation such as stretching or twisting on some areas of an image, so as to change the original layout and structure of content of the image to meet different use requirements. For example, for a head portrait photo, the user may stretch the human face by using the image deforming technology, to achieve an image effect similar to a “distorting mirror”.
In the image deforming technology, space mapping is a core means used to change image structure. By using space mapping processing, a terminal maps pixels in some areas of an original image to other positions in a deformed image by means of displacement mapping, so as to obtain a pixel position relationship in the deformed image that is different from that of the original image, thereby achieve an objective of changing the image structure. In current production practice processes, according to different space mapping manners, the image deforming technology is mainly divided into three types: 1. block-based image deforming; 2. line-based image deforming; and 3. point-based image deforming. The main concept of the block-based image deforming manner is to divide a deforming area into multiple image blocks, perform space mapping on the different image blocks according to different offset amounts, and combine the image blocks after the space mapping; the main concept of line-based image deforming is to construct a series of characteristic lines in a deforming area, obtain through calculation an offset amount of each pixel according to distances from pixels to the characteristic lines, and perform space mapping on the deforming area according to the offset amounts obtained through calculation; the main concept of point-based image deforming is to construct a series of discrete characteristic points in a deforming area, and implement space mapping on the deforming area by specifying a mapping relationship between special characteristic points and using an appropriate radial basis function.
No matter for block-based deforming, line-based deforming or point-based deforming, the existing technology needs to determine, based on specific content of the image, the number and distribution of characteristic quantities before space mapping, for example, how many image blocks the image is divided into, how to determine a position of an image block, and so on. To ensure smoothness and a stability boundary after image deforming, generally the content of the image needs to be analyzed by using a complex algorithm, which leads to a massive amount of calculation, and causing the image deforming process to take too much time. Especially when a higher-order function is used in the image analysis or space mapping process, the amount of calculation further increases, which cannot adapt to real-time response requirements on the terminal.